<template>

 
 <el-breadcrumb separator="/">
          <el-breadcrumb-item :to="{ path: '/' }">主页面</el-breadcrumb-item>
          <el-breadcrumb-item>牛场管理</el-breadcrumb-item>
          <el-breadcrumb-item>牛舍住宿信息修改</el-breadcrumb-item>
         </el-breadcrumb>
  <el-divider/>

  <el-descriptions title="牛舍信息查询窗口" :column="2"  border>

    <!-- 牛的耳号 -->

    <el-descriptions-item label="牛的耳号" >

      <el-input v-model="cattleAddress.cattleId" style="width: 220px" placeholder="请输入耳号" clearable />

    </el-descriptions-item>

    <el-descriptions-item label="牛舍位置" >

      <el-input v-model="cattleAddress.address" style="width: 220px" placeholder="请输入牛舍位置" clearable />

    </el-descriptions-item>


  </el-descriptions>

  <el-divider/>
  <!-- 添加按钮 -->

   <el-button type="primary" round @click="addCattleAddress">修改</el-button>

   

</template>


<script setup lang="ts">

import axios from 'axios';
import { ref } from 'vue';


const urlParams = new URLSearchParams(window.location.search);
let  cattleId= urlParams.get('cattleId')

// const cattle = ref({
 
//   cattleId: cattleId,

//   breedId: '',

//   birthday: '', // 初始化为''

//   birthdayValue: null as Date | null, // 用于存储el-date-picker的值，可转换为日期字符串

//   weight: '',

//   sex: '',

//   quarantineSituation: '',

//   remark: '',

// });
const cattleAddress= ref({
 
  cattleId: cattleId,
  address: '',

});


function refresh() {
    location.reload();
  }

 function addCattleAddress() {

 axios.post("http://localhost:8080/cattleAddressBase/updateCattleAddressBase", cattleAddress.value)

    .then(function (response) {

      console.log(response.data);

    })

    .catch(function (error) {

      console.error(error);

    });
    refresh();
}

</script>


